import React, { Component } from 'react';

class Error extends Component {
   
    componentDidMount() {
        this.interval = setTimeout(this.onEnded, this.props.media.playTime * 1000)
    }

    componentWillReceiveProps(nextProps) {
        this.interval = setTimeout(this.onEnded, nextProps.media.playTime * 1000)
    }

    componentWillUnmount() {
        clearInterval(this.interval)
    }

    onEnded=()=> {
        this.props.startNextMedia()
    }
    
    render() {
        console.log(this.props.media && this.props.media.src, "videosrc")
        return (
            <div className="error">
                不支持当前文件类型播放,或类型填写错误。
            </div>

        );
    }
}

export default Error;
